home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
APP
/
M-R
/
PSpice.cpt
/
Example1.cir
< prev
next >
Wrap
Text File
|
1990-09-13
|
10KB
|
236 lines
EXAMPLE1 - An Illustration of PSpice Capabilities
*
* This circuit, a differential pair, shows many of the capabilities of PSpice.
* It creates a large amount of output for such a small circuit. Normally,
* only a few kinds of analysis, such as transient analysis, would be run.
*
* This command sets options for the run.
.OPT ACCT NOMOD NOPAGE RELTOL=.001
* Sets the width of the output to 80 columns.
.WIDTH OUT=80
* Sets the temperature for the run to 35 degrees celsius.
.TEMP 35
* This command does a DC sweep. The voltage source VIN is swept from
* -0.125 volts to 0.125 volts in steps of 0.005 volts. The non-linear
* device equations are used.
.DC VIN -0.125 0.125 0.005
* There is no command to do a small-signal bias point calculation. It
* is done automatically after the DC sweep is finished. The non-linear
* device equations are used to find the bias point. Then, the linearized,
* small-signal equivalent circuit at the bias point is saved for the .TF,
* .SENS, .AC, and .NOISE analysis. This command prints out the small-
* signal parameters for each device.
.OP
* This command does a small-signal transfer function calculation assuming
* VIN is the input and V(5), the voltage at node 5, is the output.
.TF V(5) VIN
* This does an AC analysis. The real and imaginary response of the circuit
* is calculated as the inputs are swept from 100 kilohertz to 10 gigahertz
* by decades with 10 points per decade. The only AC input this circuit has
* is VIN. This is a linear analysis.
.AC DEC 10 100KHZ 10GHZ
* This command does noise calculations during the AC analysis. Each
* device's noise contribution is calculated and propogated to node 5.
* All the contributions are rms-summed at node 5. Besides the total
* output noise printout done for every frequency, a detailed table of
* each device's contribution is done every 30'th frequency.
.NOISE V(5) VIN 30
* This command does a transient analysis. It first re-calculates the
* circuit's bias point, then calculates the circuit's time response
* from 0 nanoseconds to 250 nanoseconds using the full, non-linear device
* equations, including non-linear capacitances. PSpice uses a variable
* time step for the calculations, but this command causes the results
* to be interpolated onto a 5 nanosecond print interval. Transient
* analysis is the most frequently used analysis in PSpice.
.TRAN 20NS 1000NS
* This does a harmonic decomposition on the waveform V(5) calculated
* during transient analysis. It calculates the magnitude and phase
* of the fundamental (5 megahertz) and the first eight harmonics.
* The graphics post-processor, Probe, goes further and contains
* a full FFT, allowing complete spectra to be displayed.
.FOUR 5MEG V(5)
* This command does a Monte Carlo analysis of the circuit. It runs
* the DC sweep 5 times using the tolerances in .MODEL statements
* and compares the waveform V(4,5) from each run against the nominal
* V(4,5). It then lists a table of each run's deviation from the
* nominal. The Monte Carlo option can also do Worst Case and Sensitivity
* analysis.
.MC 5 DC V(4,5) YMAX
* PSpice allows parameters to be defined and used in expressions
* throughout the circuit file. Parameters may also be passed into
* subcircuits as arguments and used inside. Here, we define a
* fudge factor for the supply voltages.
.PARAM FACTOR=1.2
* The following statements describe the circuit to PSpice. It is a
* simple differential pair, with +12 and -12 volts as the supplies.
* VIN is the input for this circuit. It has an amplitude during AC analysis
* of 1 volt and a sine waveform during transient of .1 volt at 5 megahertz.
VIN 100 0 AC 1 SIN(0 0.1 5MEG)
* The power supplies are + and - SUPPLY volts. As mentioned above,
* expressions containing parameters can be used for values throughout
* the circuit file. Expressions are enclosed by "{" and "}" and allow
* arithmetic expressions.
VCC 101 0 DC {10*FACTOR}
VEE 102 0 {-10*FACTOR}
* The transistors' nodes are in the order collector - base - emitter.
* All transistors must refer to a model (QNL in this case).
Q1 4 2 6 QNL
Q2 5 3 6 QNL
* Models for resistors are optional. If used they can specify such things
* as scaling, temperature coefficients, and tolerances.
RS1 100 2 1K
RS2 3 0 1K
RC1 4 101 CRES 10K
RC2 5 101 CRES 10K
Q3 6 7 102 QNL
Q4 7 7 102 QNL
RBIAS 7 101 20K
CLOAD 4 5 5PF
* This statement describes the CRES resistor by giving the values for
* the parameters. Each type of model has its own set of parameters.
* All parameters have default values. In CRES we have set the scaling
* factor to 1, the linear temperature coefficient to .02, and the
* quadratic temperature coefficient to .0045, and given each resistor
* a 5% tolerance on its value during Monte Carlo analysis.
.MODEL CRES RES (R=1 DEV=5% TC1=.02 TC2=.0045)
* The bipolar transistor model is the Gummel-Poon model. It uses the
* same equations as in the UC Berkeley Spice program. There are
* actually 55 model parameters, but most of these are for second-order
* effects that are rarely used. Most bipolar models for realistic
* circuits specify between 12 and 25 parameters and default the rest.
* Here, we have set the forward beta to 80, the base resistance to
* 100 ohms, the collector-substrate capacitance to 2 picofarads, the
* forward transit time to 0.3 nanoseconds, the reverse transit time to
* 6 nanoseconds, the base-emitter capacitance to 3 picofarads, the
* base-collector capacitance to 2 picofarads, and the forward Early
* voltage to 50 volts. The capacitances are actually voltage dependent.
* These numbers are the zero-bias values.
.MODEL QNL NPN (BF=80 RB=100 CCS=2PF TF=0.3NS TR=6NS CJE=3PF CJC=2PF
+ VA=50)
* The Analog Behavioral Modeling option allows one to define a transfer
* function by formula and/or by table. Here, we implement an ideal
* comparator to convert the differential output across nodes 4 and 5 into
* a TTL output on node 10. The voltage across 4 and 5 is multiplied by 1e5
* and that value is looked up in the table. The table has an output of 0v
* for inputs < 0, 5v for inputs > 5, and output=input in between.
* So, the comparator has a gain of 100,000 and saturates at 0v and 5v.
* Although not shown here, one can also define linear transfer functions
* by Laplace transform formulas or by frequency response tables.
E1 10 0 TABLE {V(4,5)*1e5} (0v,0v 5v,5v)
RE1 10 0 1K
* The Digital Simulation option simulates digital components. Instead
* of voltages and waveforms, it calculates 1's and 0's and propogation
* delays. PSpice automatically creates interface components between
* analog and digital sections or circuitry. Here, we drive a 74293,
* 4-bit, ripple counter from the output of the comparator E1.
X1 10 QA 110 110 QA QB QC QD 74293
* This is a digital stimulus which resets the counter
U2 STIM(1, 1) 110 STMIOMDL TIMESTEP = 10NS
+ 0nS, 1
+ 40nS, 0
* These commands provide print and plot output for selected voltages
* and currents. The plots are the so-called "line printer" plots.
* That is, plots made out of characters. To get real, high-resolution
* plots you need to use Probe; it is invoked by the .PROBE command.
.PRINT DC V(4) V(5)
.PLOT DC IC(Q2)
.PLOT AC VCM(Q2) VCP(Q2)
.PLOT NOISE INOISE ONOISE
.PLOT TRAN V(4,5) V(10) D(QA) D(QB)
.PROBE
* We have included the full subcircuit and model definitions here in
* order to make the EXAMPLE1.CIR file self-contained. These models
* come from the digital library files and would normally be accessed
* by using a .LIB command instead of reproducing them in the circuit
* file.
.SUBCKT 74293 CKA CKB R01 R02 QA QB QC QD
U1 NAND(2) R01 R02 RBAR D0_GATE IO_DFT
U2 JKFF(1) $D_HI RBAR CKA $D_HI $D_HI QA $D_NC D_293ASTD IO_STD
U3 JKFF(1) $D_HI RBAR CKB $D_HI $D_HI QB $D_NC D_293BSTD IO_STD
U4 JKFF(1) $D_HI RBAR QB $D_HI $D_HI QC $D_NC D_293BSTD IO_STD
U5 JKFF(1) $D_HI RBAR QC $D_HI $D_HI QD $D_NC D_293BSTD IO_STD
.ENDS
.MODEL D0_GATE UGATE
.MODEL IO_DFT UIO (DRVH=50 DRVL=50 AtoD=STDATOD DtoA=STDDTOA)
.MODEL IO_STD UIO (DRVH=60 DRVL=30 AtoD=STDATOD DtoA=STDDTOA)
.MODEL D_293ASTD UEFF (
+ TPPCQHLTY = 26ns TPPCQHLMX = 40ns
+ TPCLKQLHTY = 10ns TPCLKQLHMX = 16ns
+ TPCLKQHLTY = 12ns TPCLKQHLMX = 18ns
+ TWCLKHMN = 15ns TWCLKHTY = 15ns TWCLKHMX = 15ns
+ TWCLKLMN = 15ns TWCLKLTY = 15ns TWCLKLMX = 15ns
+ TSUPCCLKHMN = 25ns TSUPCCLKHTY = 25ns TSUPCCLKHMX = 25ns
+ TWPCLTY = 15ns TWPCLMX = 15ns )
.MODEL D_293BSTD UEFF (
+ TPPCQHLTY = 26ns TPPCQHLMX = 40ns
+ TPCLKQLHTY = 10ns TPCLKQLHMX = 16ns
+ TPCLKQHLTY = 14ns TPCLKQHLMX = 21ns
+ TWCLKHMN = 30ns TWCLKHTY = 30ns TWCLKHMX = 30ns
+ TWCLKLMN = 30ns TWCLKLTY = 30ns TWCLKLMX = 30ns
+ TSUPCCLKHMN = 25ns TSUPCCLKHTY = 25ns TSUPCCLKHMX = 25ns
+ TWPCLTY = 15ns TWPCLMX = 15ns )
*
* The digital power supply subckt:
* one instance of this subcircuit is created if any AtoD or DtoA
* subckts are created. The one interface pin is always given the
* value "0".
.subckt digifpwr gnd
vdigpos $G_dig_pos $G_dig_neg 5v
r1 $G_dig_pos gnd 1MEG
vdigneg $G_dig_neg gnd 0v
r2 $G_dig_neg gnd 1MEG
vdigref $G_dig_ref gnd 0v
r3 $G_dig_ref gnd 1MEG
.ends
.model stmiomdl UIO (drvh=0 drvl=0 AtoD=STDATOD DtoA=STDDTOA)
* Simple AtoD and DtoA subckts: use globals to connect to power supply
.subckt stdAtoD a d
o1 a $G_dig_ref DOTTLSCH Dgtlnet = d IO_STD
.ends
.subckt stdDtoA d a
n1 a $G_dig_neg $G_dig_pos DIN74 dgtlnet = d IO_STD
.ends
.model DIN74 dinput(
+ s0name = 0, s0tsw = 5ns, s0rlo = 8.54 s0rhi = 238.9,
+ s1name = 1, s1tsw = 8ns, s1rlo = 486 s1rhi = 209,
+ s2name = X, s2tsw = 4ns, s2rlo = 64.4 s2rhi = 90.1,
+ s3name = Z, s3tsw = 8ns, s3rlo = 100k s3rhi = 100k)
.model DOTTLSCH doutput(
+ s0name = 0, s0vlo = -1.5, s0vhi = 1.4,
+ s1name = 1, s1vlo = 1.40, s1vhi = 7.0)
.END